package cn.hill4j.tool.spring.ext.iop.jdkproxy;

import cn.hill4j.tool.spring.ext.iop.BaseIopClientBuilder;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
/**
  * ClassName: JdkProxyIopClientBuilder
  * Description: jdk动态代理iopClient构造器
  * @author hillchen
  * Date: 2023/8/12
  * @version: 1.0
  */
public abstract class JdkProxyIopClientBuilder extends BaseIopClientBuilder implements InvocationHandler {
    /**
     * @author hillchen
     * Description: 构造jdk动态代理iopClient
     * Date: 2023/8/12 23:17
     * @param <T> 代理接口类型
     * @return T
     **/
    @Override
    public <T> T buildClient() {
        return (T) Proxy.newProxyInstance(getInterfaceClazz().getClassLoader(),new Class[]{getInterfaceClazz()},this);
    }
}
